package org.dawn.deveco.plugin.resourceeditor.common;

import org.dawn.deveco.plugin.resourceeditor.utils.FileUtils;

import javax.swing.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class Constants {

    public static final boolean DEBUG = false;

    public static final String PLUGIN_NAME = "Resource Editor";

    // 资源表格中每行的删除按钮图标大小
    public static final int DELETE_ICON_SIZE = 32;

    // Media 表格中图标显示大小
    public static final int MEDIA_ICON_SIZE = 32;

    // region 图标资源
    public static final String FILE_ICON_PATH = "/icon/file_32x32.png";
    public static final String DELETE_ICON_PATH = "/icon/deleteItem_48x48.png";
    public static final String ADD_ICON_PATH = "/icon/addItem_32x32.png";
    public static final String LOAD_RESOURCE_ICON_PATH = "/icon/装载.png";

    public static final ImageIcon DELETE_ICON = new ImageIcon(Objects.requireNonNull(Constants.class.getResource(DELETE_ICON_PATH)));

    public static final ImageIcon ADD_ICON = new ImageIcon(Objects.requireNonNull(Constants.class.getResource(ADD_ICON_PATH)));
    // endregion

    public static final String[] IMAGE_FILE_EXTENSIONS = new String[]{"png", "jpg", "jpeg", "gif", "bmp"};

    // region 资源类型名称
    public static final String MEDIA_CATEGORY = "Media";
    public static final String STRING_CATEGORY = "String";
//    public static final String COLOR_CATEGORY = "Color";
//    public static final String DIMENSION_CATEGORY = "Dimension";
    // endregion

    // 与资源类型对应的资源文件路径集合
    public static final Map<String, String> RESOURCE_PATH_MAP = new HashMap<String, String>() {{
        put(MEDIA_CATEGORY, FileUtils.convertToOsPath("base\\media"));  // 图片文件目录
        put(STRING_CATEGORY, FileUtils.convertToOsPath("base\\element\\string.json"));
//        put(COLOR_CATEGORY, "base\\element\\color.json");
//        put(DIMENSION_CATEGORY, "base\\element\\dimen.json");
    }};

    public static final String RESOURCE_FILE_SUB_PATH = FileUtils.convertToOsPath("base\\element");
    public static final String RESOURCE_FILE_EXTENSION = ".json";

    // 资源文件根目录 <Project_dir>/entry/src/main/resources
    // 其子目录（base/element）中应该包含资源文件，例如：string.json、color.json 等。
    public static  String RESOURCE_ROOT_PATH = "E:\\resources";
}
